<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>栈结构</title>
	</head>
	<body>
		<script src="index.js"></script>
		<script>
			// 二进制转换
			function sum(num) {
				let stack = new Stack()
				while (num > 0) {
					let s = num % 2
					stack.push(s)
					num = Math.floor(num / 2)
				}
				let b = ''
				while (!stack.isEmpty()) {
					b += stack.pop()
				}
				console.log(b)
			}
			sum(6)
		</script>
	</body>
</html>
